<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 通过循环按行顺序为一个5×5的二维数组a赋1到25的自然数，然后输出该数组。试编程。 -->

    <script>
      var arr = [];
      var res = [];

      for (i = 1; i <= 25; i++) {
        res.push(i);

        if (i % 5 == 0) {
          arr.push(res);
          document.write("[" + res + "]" + "<br>");
          res = [];
        }
      }
      console.log(arr);
    </script>
  </body>
</html>
